<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <script>
        function doLocation(){
            // 获取地址栏中的url
            // console.log(location.href);

            // 设置地址栏中的url，实现页面跳转
            // location.href='https://www.baidu.com';
            // location='https://www.baidu.com'; // 简写

            // 刷新页面
            location.reload();
        }
    </script>
</head>
<body>
    <button onclick="doLocation()">操作location</button>
</body>
</html>